#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-07-27 10:15 上午
# @Author  : yangdy
# @File    : 2020-07-27.392.判断子序列
# @Software: PyCharmCE
from my_methods import *


class Solution:
    def isSubsequence(self, s: str, t: str) -> bool:
        ans = False
        i, j, ls, lt = 0, 0, len(s), len(t)
        while i < ls and j < lt:
            if s[i] == t[j]:
                i, j = i+1, j+1
            else:
                j += 1
        ans = i >= ls

        return ans


questions = [
    ('abc', 'ahbgdc'),
    ('axc', 'ahbgdc'),
]

work(questions, lambda x: Solution().isSubsequence(x[0], x[1]))
